package school;
import java.util.ArrayList;
import java.util.Random;

import java.util.ArrayList;

public class ClassRoom {
        private ArrayList<Group>groups;
        private ArrayList<Student>AllStudents;
        private String ClassName;
        public ClassRoom(String ClassName){
        this.ClassName = ClassName;
        groups = new ArrayList<>();
        AllStudents = new ArrayList<>();
    }
    public void addGroup(Group group){
            groups.add(group);
            AllStudents.addAll(group.Students);
        }
    public Group getRandomGroup() {
        if (groups.isEmpty()) {
            return null;
        }
        Random rand = new Random();
        return groups.get(rand.nextInt(groups.size()));
    }
    public Student getRandomStudentFromGroup(Group group) {
        return group.getRandomStudent();
    }
    public Student getRandomStudentFromClass() {
        if (AllStudents.isEmpty()) {
            return null;
        }
        Random rand = new Random();
        return AllStudents.get(rand.nextInt(AllStudents.size()));
    }
    public String getClassName() {
        return ClassName;
    }

}



